
fn string_hash(input: &str) -> u32 {
    let mut result = 5381u32;
    for &byte in input.as_bytes() {
        result = result.wrapping_shl(5).wrapping_add(result).wrapping_add(byte as u32);
    }
    result
}

fn string_nocase_hash(input: &str) -> u32 {
    let mut result = 5381u32;
    for c in input.chars() {
        let c_lower = c.to_lowercase().next().unwrap_or(c); // Convert to lowercase, handle non-ASCII
        result = result.wrapping_shl(5).wrapping_add(result).wrapping_add(c_lower as u32);
    }
    result
}

fn main() {
    let test_string = "Hello, World!";
    let hash = string_hash(test_string);
    let nocase_hash = string_nocase_hash(test_string);
    println!("Hash: {}", hash);
    println!("NoCase Hash: {}", nocase_hash);
}

